import React from 'react';
import {View, Text, TouchableOpacity} from 'react-native';
import ChirdB from './ChirdB'
import ChirdC from './ChirdC'
import ChirdB1 from "./ChirdB1";
import ChirdB2 from "./ChirdB2";
import ChirdB3 from "./ChirdB3";
import ChirdB4 from "./ChirdB4";
import ChirdB5 from "./ChirdB5";

export default class Chird2 extends React.Component {

  state = {
    count: 0,
    data:{count:0},
    array:[]
  }


  render() {
    console.log('Chird2 render', this.state.count);
    const arr = this.state.array;
    arr.push(this.state.count);
    console.log('Chird2 render arr', arr);

    return (
      <View>
        <TouchableOpacity
          onPress={() => {
            const count = this.state.count + 1;
            this.setState({
              count: count,
              data:{count:count},
            })
          }}>
          <Text>二级页面</Text>
          <Text>Chird2</Text>
        </TouchableOpacity>
        <ChirdB count={this.state.count}/>
        <ChirdB1 count={this.state.count}/>
        <ChirdB2 count={this.state.count}/>
        <ChirdB3 count={this.state.data}/>
        <ChirdB4 count={{count:this.state.count}}/>
        <ChirdB5 count={arr}/>
        <ChirdC/>
      </View>
    )
  }
}
